package com.linln.modules.member.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.linln.modules.member.domain.Membernotice;

/**
 * @author hct
 * @date 2019/10/11
 */
public interface MembernoticeRepository extends JpaRepository<Membernotice, Long> {

	@Modifying
	@Transactional
	@Query("update Membernotice set noticestatus = ?1  where id in ?2 ")
	public Integer updateNoticeStatusByIds(Integer status,List<Long> ids);
	@Modifying
	@Transactional
	@Query("update Membernotice set noticestatus = ?1  where id = ?2 ")	
	public Integer updateNoticeStatusById(Integer status,Long id);
	@Modifying
	@Transactional
	@Query("update Membernotice set isread = 1  where id = ?1 ")	
	public Integer updateIsreadById(Long id);
	@Modifying
	@Transactional
	@Query("update Membernotice set isread = 1  where type=?1 and typeId = ?2 and noticestatus=2 and isread=0")		
	public Integer updateIsreadById(Integer type,Long typeId);

	
	
}